{extend name="common/adminBase" /}
{block name="body"}
<style>
    .layui-input-inline{
        width: 400px !important;
    }
</style>
    <body >
        <div class="layui-fluid">
            <div class="layui-row">

                <form class="layui-form">
                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>角色选择
                        </label>
                        <div class="layui-input-inline">
                            <select name="rid">
                                <option value="12">专家</option>
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>真实姓名
                        </label>
                        <div class="layui-input-inline">
                            <input type="text"  name="name" required="" lay-verify="required"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>手机号码
                        </label>
                        <div class="layui-input-inline">
                            <input type="text"  name="phone" autocomplete="off" class="layui-input">
                        </div>

                    </div>
                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>身份证号<br/>专家登录系统的用户名
                        </label>
                        <div class="layui-input-inline">
                            <input type="text"  name="idcard" value="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                  <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>email邮箱
                        </label>
                        <div class="layui-input-inline">
                            <input type="text"  name="email" autocomplete="off" class="layui-input">
                        </div>
                  </div>
                
                    
                    
           
                        <div class="layui-form-item">
                              <label for="username" class="layui-form-label">
                                  <span class="x-red">*</span>评分对象
                              </label>
                              <div class="layui-input-inline">
                                    <select name="z_type">
                                        <option value="全部课题">全部课题</option>
                                        <option value="重点课题">重点课题</option>
                                        <option value="一般课题">一般课题</option>
                                        
                                    </select>
                              </div>
                          </div>
                 
                    
                    <div id="change">
                        
                    </div>
                  <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>登录密码
                        </label>
                        <div class="layui-input-inline">
                            <input type="text"  name="password" autocomplete="off" class="layui-input">
                        </div>

                  </div>

        
                  <div class="layui-form-item">
                      <label for="L_repass" class="layui-form-label">
                      </label>
                      <button  class="layui-btn" lay-filter="add" lay-submit="">
                          增加
                      </button>
                      <button  class="layui-btn" onclick="window.history.go(-1);">
                          返回
                      </button>
                  </div>
              </form>
             <div class="layui-col-md6">
              <div class="layui-panel">
                <div style="padding: 50px 30px;">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
                      <legend>批量导入专家</legend>
                    </fieldset> 
                     {if $admin.lv==0}
                    <div class="layui-upload-drag" id="test1">
                      <i class="layui-icon"></i>
                      <p>点击上传，或将文件拖拽到此处</p>
                      <div class="layui-hide" id="uploadDemoView2">
                        <hr>
                        <img src="" alt="上传成功后渲染" style="max-width: 196px">
                      </div>
                    </div>
                    {/if}
                    {if $admin.lv==2}
                    <div class="layui-upload-drag" id="test2">
                      <i class="layui-icon"></i>
                      <p>点击上传，或将文件拖拽到此处</p>
                      <div class="layui-hide" id="uploadDemoView2">
                        <hr>
                        <img src="" alt="上传成功后渲染" style="max-width: 196px">
                      </div>
                    </div>
                    {/if}
                    {if $admin.lv==3}
                    <div class="layui-upload-drag" id="test3">
                      <i class="layui-icon"></i>
                      <p>点击上传，或将文件拖拽到此处</p>
                      <div class="layui-hide" id="uploadDemoView2">
                        <hr>
                        <img src="" alt="上传成功后渲染" style="max-width: 196px">
                      </div>
                    </div>
                    {/if}
                </div>
                <a type="button" style="margin-left:105px;" href="/uploads/专家导入模板.xlsx" class="layui-btn layui-btn-normal">下载模板</a>
              </div>   
            </div>
            </div>
        </div>
        <script>

            layui.use(['form', 'layer','upload'],
            function() {
                $ = layui.jquery;
                var form = layui.form,
                upload = layui.upload,
                layer = layui.layer;


                upload.render({
                    elem: '#test3'
                    ,url: '/index/index/uploadzj?type=3' //改成您自己的上传接口
                    ,accept: 'file'
                    ,'field':'file'
                    ,done: function(res){
                      layer.msg('上传成功');
                    //   layui.$('#uploadDemoView').removeClass('layui-hide').find('img').attr('src', res.files.file);
                      window.location.href='/index/Power/zhuanjia';
                    }
                  });
                  upload.render({
                    elem: '#test2'
                    ,url: '/index/index/uploadzj?type=2' //改成您自己的上传接口
                    ,accept: 'file'
                    ,'field':'file'
                    ,done: function(res){
                      layer.msg('上传成功');
                    //   layui.$('#uploadDemoView').removeClass('layui-hide').find('img').attr('src', res.files.file);
                      window.location.href='/index/Power/zhuanjia';
                    }
                  });
                  upload.render({
                    elem: '#test1'
                    ,url: '/index/index/uploadzj?type=1' //改成您自己的上传接口
                    ,accept: 'file'
                    ,'field':'file'
                    ,done: function(res){
                      layer.msg('上传成功');
                    //   layui.$('#uploadDemoView').removeClass('layui-hide').find('img').attr('src', res.files.file);
                      window.location.href='/index/Power/zhuanjia';
                    }
                  });
                //监听提交
                form.on('submit(add)', function(data) {
                    console.log(data);
                    //发异步，把数据提交给php
                    $.ajax({
                        url:"/index/power/addzhuanjia",
                        data:data.field,
                        type:'post',
                        dataType:'json',
                        success:function (res) {
                            if (res.status==1){
                                layer.msg("增加成功",{icon:6,time:1500},function() {
                                    //关闭当前frame
                                    xadmin.close();
                                    // 可以对父窗口进行刷新
                                    xadmin.father_reload();
                                });
                            }else{
                                layer.alert(res.msg,function (index) {
                                    layer.close(index);
                                })
                            }
                        }
                    })

                    return false;
                });

            });

        </script>

    </body>

{/block}
